﻿using System;
using System.Collections.Generic;
using System.Net;

namespace Nextensions.Net.Protocols.Http
{
    public class HttpResponse
    {
        public HttpResponse(string URL, string HTML, HttpStatusCode Status): this(URL, HTML, Status, null, new string[0]{})
        {
        }

        public HttpResponse(string URL, string HTML, HttpStatusCode Status, string[] Cookies)
            : this(URL, HTML, Status, null, Cookies)
        { 
        }

        public HttpResponse(string URL, string HTML, HttpStatusCode Status, string RedirectURL, string[] Cookies)
        {
            this.URL = URL;
            this.HTML = HTML;
            this.Status = Status;
            this.RedirectURL = RedirectURL;
            if (Cookies == null)
                this.Cookies = new List<string>(0);
            else
                this.Cookies = new List<string>(Cookies);
        }

        public override string ToString()
        {
            return String.Format("{0}. {1}", Status, String.Join("; ", Cookies.ToArray()));
        }

        public List<string> Cookies { get; set; }
        public string HTML { get; set; }
        public HttpStatusCode Status { get; set; }
        public string URL { get; set; }
        public string RedirectURL { get; set; }
        public TimeSpan TimeTaken { get; set; }
    }
}